import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '性别',
    align:"center",
    dataIndex: 'sex_dictText'
   },
   {
    title: '工号',
    align:"center",
    dataIndex: 'workNo'
   },
   {
    title: '账号',
    align:"center",
    dataIndex: 'userName'
   },
   {
    title: '所属部门',
    align:"center",
    dataIndex: 'belongingDepart_dictText'
   },
   {
    title: '所属岗位',
    align:"center",
    dataIndex: 'workPosition_dictText'
   },
   {
    title: '角色',
    align:"center",
    dataIndex: 'roles_dictText'
   },
   {
    title: '手机号',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '民族',
    align:"center",
    dataIndex: 'minzu'
   },
   {
    title: '证件类型',
    align:"center",
    dataIndex: 'cardType_dictText'
   },
   {
    title: '证件号码',
    align:"center",
    dataIndex: 'cardCode'
   },
   {
    title: '邮编',
    align:"center",
    dataIndex: 'postcode'
   },
   {
    title: '邮箱',
    align:"center",
    dataIndex: 'email'
   },
   {
    title: '最高学历',
    align:"center",
    dataIndex: 'educationalBackground'
   },
   {
    title: '毕业院校',
    align:"center",
    dataIndex: 'school'
   },
   {
    title: '户籍所在地',
    align:"center",
    dataIndex: 'domicile'
   },
   {
    title: '工作经历',
    align:"center",
    dataIndex: 'workExperience',
   },
   {
    title: '本人照片',
    align:"center",
    dataIndex: 'photograph',
    customRender:render.renderImage,
   },
   {
    title: '签名图片',
    align:"center",
    dataIndex: 'signature',
    customRender:render.renderImage,
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "工号",
      field: "workNo",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "账号",
      field: "userName",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "所属部门",
      field: "belongingDepart",
      component: 'JSelectDept',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入姓名!'},
          ];
     },
  },
  {
    label: '性别',
    field: 'sex',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"sex"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入性别!'},
          ];
     },
  },
  {
    label: '工号',
    field: 'workNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入工号!'},
          ];
     },
  },
  {
    label: '账号',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入账号!'},
          ];
     },
  },
  {
    label: '所属部门',
    field: 'belongingDepart',
     component: 'JSelectDept',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入所属部门!'},
          ];
     },
  },
  {
    label: '所属岗位',
    field: 'workPosition',
    component: 'JSelectMultiple',
    componentProps:{
        dictCode:"sys_position,name,id"
     },
  },
  {
    label: '角色',
    field: 'roles',
    component: 'JSearchSelect',
    componentProps:{
       dict:"sys_role,role_name,id"
    },
  },
  {
    label: '手机号',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '民族',
    field: 'minzu',
    component: 'Input',
  },
  {
    label: '证件类型',
    field: 'cardType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"cardType"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入证件类型!'},
          ];
     },
  },
  {
    label: '证件号码',
    field: 'cardCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入证件号码!'},
          ];
     },
  },
  {
    label: '邮编',
    field: 'postcode',
    component: 'Input',
  },
  {
    label: '邮箱',
    field: 'email',
    component: 'Input',
  },
  {
    label: '最高学历',
    field: 'educationalBackground',
    component: 'Input',
  },
  {
    label: '最高学历',
    field: 'educationalBackground',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"educationalBackground"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入最高学历!'},
          ];
     },
  },
  {
    label: '毕业院校',
    field: 'school',
    component: 'Input',
  },
  {
    label: '户籍所在地',
    field: 'domicile',
    component: 'InputTextArea',
  },
  {
    label: '工作经历',
    field: 'workExperience',
    component: 'JEditor',
  },
  {
    label: '本人照片',
    field: 'photograph',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '签名图片',
    field: 'signature',
     component: 'JImageUpload',
     componentProps:{
      },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const tbPeopleCertificateColumns: JVxeColumn[] = [
    {
      title: '证件类型',
      key: 'type',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '资格证名称',
      key: 'name',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '是否过期',
      key: 'isFlag',
      type: JVxeTypes.select,
      options:[],
      dictCode:"yn",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '有效开始时间',
      key: 'startDate',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '有效结束时间',
      key: 'endDate',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '是否验证',
      key: 'isVerify',
      type: JVxeTypes.select,
      options:[],
      dictCode:"yn",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]
export const tbPeopleEducationTrainingColumns: JVxeColumn[] = [
    {
      title: '计划名称',
      key: 'trainingPlanId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '课程名称',
      key: 'courseId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '课程学士时长',
      key: 'duration',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '试卷名称',
      key: 'paperId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '及格分数',
      key: 'passingMark',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '题目数',
      key: 'standardNumber',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '实际得分',
      key: 'actualMark',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '题目正确数',
      key: 'actualCorrectNumber',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '是否及格',
      key: 'isFiag',
      type: JVxeTypes.select,
      options:[],
      dictCode:"yn",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]
export const tbPeopleRewardsPunishmentsColumns: JVxeColumn[] = [
    {
      title: '创建日期',
      key: 'createTime',
      type: JVxeTypes.datetime,
      disabled:true,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '奖惩分类',
      key: 'rewardPunishmentType',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '奖惩类别',
      key: 'rewardPunishmentCategory',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '事由描述',
      key: 'causeDescription',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '奖惩描述',
      key: 'rewardPunishmentDescription',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  name: {title: '姓名',order: 0,view: 'text', type: 'string',},
  sex: {title: '性别',order: 1,view: 'radio', type: 'string',},
  workNo: {title: '工号',order: 2,view: 'text', type: 'string',},
  userName: {title: '账号',order: 3,view: 'text', type: 'string',},
  belongingDepart: {title: '所属部门',order: 4,view: 'sel_depart', type: 'string',},
  workPosition: {title: '所属岗位',order: 5,view: 'list_multi', type: 'string',dictTable: "sys_position", dictCode: 'id', dictText: 'name',},
  roles: {title: '角色',order: 6,view: 'sel_search', type: 'string',dictTable: "sys_role", dictCode: 'id', dictText: 'role_name',},
  phone: {title: '手机号',order: 7,view: 'text', type: 'string',},
  minzu: {title: '民族',order: 8,view: 'text', type: 'string',},
  cardType: {title: '证件类型',order: 9,view: 'radio', type: 'string',},
  cardCode: {title: '证件号码',order: 10,view: 'text', type: 'string',},
  postcode: {title: '邮编',order: 11,view: 'text', type: 'string',},
  email: {title: '邮箱',order: 12,view: 'text', type: 'string',},
  educationalBackground: {title: '最高学历',order: 13,view: 'text', type: 'string',},
  school: {title: '毕业院校',order: 14,view: 'text', type: 'string',},
  domicile: {title: '户籍所在地',order: 15,view: 'textarea', type: 'string',},
  workExperience: {title: '工作经历',order: 16,view: 'umeditor', type: 'string',},
  photograph: {title: '本人照片',order: 17,view: 'image', type: 'string',},
  signature: {title: '签名图片',order: 18,view: 'image', type: 'string',},
  //子表高级查询
  tbPeopleCertificate: {
    title: '人员证书',
    view: 'table',
    fields: {
        type: {title: '证件类型',order: 0,view: 'text', type: 'string',},
        name: {title: '资格证名称',order: 1,view: 'text', type: 'string',},
        isFlag: {title: '是否过期',order: 2,view: 'radio', type: 'string',},
        startDate: {title: '有效开始时间',order: 3,view: 'date', type: 'string',},
        endDate: {title: '有效结束时间',order: 4,view: 'date', type: 'string',},
        isVerify: {title: '是否验证',order: 5,view: 'radio', type: 'string',},
    }
  },
  tbPeopleEducationTraining: {
    title: '教育培训',
    view: 'table',
    fields: {
        trainingPlanId: {title: '计划名称',order: 0,view: 'text', type: 'string',},
        courseId: {title: '课程名称',order: 1,view: 'text', type: 'string',},
        duration: {title: '课程学士时长',order: 2,view: 'text', type: 'string',},
        paperId: {title: '试卷名称',order: 3,view: 'text', type: 'string',},
        passingMark: {title: '及格分数',order: 4,view: 'text', type: 'string',},
        standardNumber: {title: '题目数',order: 5,view: 'text', type: 'string',},
        actualMark: {title: '实际得分',order: 6,view: 'text', type: 'string',},
        actualCorrectNumber: {title: '题目正确数',order: 7,view: 'text', type: 'string',},
        isFiag: {title: '是否及格',order: 8,view: 'radio', type: 'string',},
    }
  },
  tbPeopleRewardsPunishments: {
    title: '奖惩记录',
    view: 'table',
    fields: {
        createTime: {title: '创建日期',order: 0,view: 'datetime', type: 'string',},
        rewardPunishmentType: {title: '奖惩分类',order: 1,view: 'text', type: 'string',},
        rewardPunishmentCategory: {title: '奖惩类别',order: 2,view: 'text', type: 'string',},
        causeDescription: {title: '事由描述',order: 3,view: 'textarea', type: 'string',},
        rewardPunishmentDescription: {title: '奖惩描述',order: 4,view: 'textarea', type: 'string',},
    }
  },
};
